<?php
global $_GPC, $_W;
$rid = intval($_GPC['rid']);
$operation = !empty($_GPC['op']) ? $_GPC['op'] : 'display';
load()->model('reply');
load()->func('tpl');

// message($rid);

if($operation == 'addad'){
    $countmoneyid = intval($_GPC['countmoneyid']);

    if(empty($countmoneyid)){
        message('未开启数钱功能!！', '', 'error');
    }

    $insert_countmoney = array(
        'rid' => $rid,
        'uniacid' => $_W['uniacid'],
        'iscount' => intval($_GPC['iscount']),
        'countmoney_status' => intval($_GPC['countmoney_status']),
        'countmoney_time' => intval($_GPC['countmoney_time']),
        'countmoney_mannum' => 0,
        'countmoney_maxnum' => 0,
        'countmoney_title' => $_GPC['countmoney_title'],
        'countmoney_bg' => $_GPC['countmoney_bg'],
        'countmoney_pdbg' => $_GPC['countmoney_pdbg'],
        'countmoney_mbg' => $_GPC['countmoney_mbg'],
        'countmoney_myyybg' => $_GPC['countmoney_myyybg'],
        'countmoney_music' => $_GPC['countmoney_music'],
        'countmoney_title_color' => $_GPC['countmoney_title_color'],
        'countmoney_begin_music' => $_GPC['countmoney_begin_music'],
    );

    pdo_update('haoman_dpm_countmoneyreply', $insert_countmoney, array('id' => $countmoneyid));

    message("修改成功",$this->createWebUrl('setting_countmoney',array('rid'=>$rid)),"success");

}else{

    $countmoney = pdo_fetch("select * from " . tablename('haoman_dpm_countmoneyreply') . " where rid = :rid order by `id` asc", array(':rid' => $rid));

    include $this->template('setting_countmoney');

}